#!/bin/bash

echo "Instalando";
rm -r Programas;
VERSION=`ls /usr/lib/ | grep libjson | sed 's/^.*-//' | sed 's-\([0-9]\.[0-9]\)\(.*\)-\1-g'`
NUEVALINEA="LIBS := -ljson_linux-gcc-"$VERSION"_libmt -lcrypto"
echo $NUEVALINEA
sed -i "s/^LIBS.*/$NUEVALINEA/g" Makefile
make;
#make clean;
sudo chmod +x editor;
sudo chmod +x cliente;
sudo chmod +x server;
mkdir "Programas";
cd Programas;
mkdir "ServerYEditor";
mkdir "Cliente";
cd ..;
mv editor ./Programas/ServerYEditor;
mv server ./Programas/ServerYEditor;
cp ../Server/ArchivoUsuarios.txt ./Programas/ServerYEditor;
cp ../Server/*.json ./Programas/ServerYEditor;
cp ../Editor/*.gif ./Programas/ServerYEditor;
cp ../Editor/*.glade ./Programas/ServerYEditor;
cp ../Editor/*.png ./Programas/ServerYEditor;
mv cliente ./Programas/Cliente;
cp ../Cliente/*.png ./Programas/Cliente;
cp ../Cliente/*.gif ./Programas/Cliente;
cp ../Cliente/*.wav ./Programas/Cliente;
cp ../Cliente/*.bmp ./Programas/Cliente;
cp ../Cliente/*.ttf ./Programas/Cliente;
#clear
echo "Fin";
